package com.xjoyt.pay.master.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import com.xjoyt.pay.master.dao.MerchantRateRepositoryCustom;
import com.xjoyt.pay.master.po.MerchantRate;
import com.xjoyt.pay.repository.Repository;
import com.xjoyt.pay.vo.PayType;

public interface MerchantRateRepository extends Repository<MerchantRate>, MerchantRateRepositoryCustom {

	@Query(" select a from MerchantRate a where a.merchant.id = ?1 ")
	List<MerchantRate> findAllByMerchantId(String merchantId);

	@Query(" select a from MerchantRate a where a.merchant.id = ?1 and a.type = ?2 ")
	List<MerchantRate> findAllByMerchantIdAndType(String merchantId, PayType type);

	@Query(" select a from MerchantRate a where a.merchant.id = ?1 and a.type = ?2 ")
	Page<MerchantRate> findAllByMerchantIdAndType(String merchantId, PayType type, Pageable pageable);

	@Query(" select a from MerchantRate a where a.merchant.id in ?1 ")
	List<MerchantRate> findAllByMerchantIdIn(List<String> ids);

}
